<div class="row">
	<div class="box col-md-12">
		<div class="box-inner">
			<div class="box-header well">
				<h2><i class="glyphicon glyphicon-user"></i> Danh Sách Giỏ Hàng</h2>
				<div class="box-icon">
					<a href="#" class="btn btn-minimize btn-round btn-default"><i class="glyphicon glyphicon-chevron-up"></i></a>
					<a href="#" class="btn btn-close btn-round btn-default"><i class="glyphicon glyphicon-remove"></i></a>
				</div>
			</div>
			<div class="box-content">
					<table class="table table-striped table-bordered responsive">
						<thead>
							<tr role="row">
								<th>stt</th>
								<th>Khách Hàng</th>
								<th>Quản Lý</th>
								<th>Tổng tiền</th>
								<th>Ngày Mua</th>
								<th>Ngày Gởi</th>
								<th>Tình trạng</th>
								<th></th>
							</tr>
						</thead>
						<tbody><?php
						if(!empty($carts)):
							foreach($carts as $v):
							?><tr class="">
								<td><?php echo $v->getId(); ?></td>
								<td><?php echo $v->getUser()->getUsername(); ?></td>
								<td><?php echo (!empty($v->getMod()) ? $v->getMod()->getUsername() : null); ?></td>
								<td><?php echo $v->getTotalmoney(); ?></td>

								<!-- Lấy ShMod và ShUser -->

								<td><?php echo date('d - m - Y', $v->getDaterequest()); ?></td>
								<td><?php
									$time = $v->getDatedelivery();
									if(!empty($time))
										echo date('d - m - Y', $time);
									else
										echo null;
								?></td>
								<td><?php 
									$status = $v->getStatus();
									if($status == 1)
										echo '<span class="label-info label label-default">Đang Giao Hàng</span>';
									elseif($status == 2)
										echo '<span class="label-success label label-default">Đã Giao</span>';
									elseif($status == 0)
										echo '<span class="label-warning label label-default">Đang Xử Lý</span>';
									else
										echo '<span class="label-danger label label-default">Bị hủy</span>';
									
								?></td>

								<td>
									<a class="btn btn-info" href="<?php echo site_url().'mod/carts/edit/'; ?><?php echo $v->getId(); ?>">
										<i class="glyphicon glyphicon-edit icon-white"></i>
										Chỉnh sữa
									</a>
									<a class="btn btn-warning" href="<?php echo site_url().'mod/carts/delete/'.$v->getId(); ?>">
										<i class="glyphicon glyphicon-edit icon-white"></i>
										Hủy đơn
									</a>
								</td>
							</tr><?php
							endforeach;
						else:
							?><tr>
								<td colspan="8" class="text-center">Hiện không có đơn hàng nào</td>
							</tr><?php
						endif;
						?></tbody>
						<a class="btn btn-info" href="<?php echo site_url().'mod/carts/add'; ?>">
							<i class="glyphicon glyphicon-edit icon-white"></i>
							Thêm đơn hàng
						</a>
					</table>
					<ul class="pagination pagination-centered">
						<?php echo $pagination_link; ?>
					</ul>
			</div>
		</div>
	</div>
</div>